﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using TPRenderLibrary;
namespace TPBaseDataLibrary
{
    public class TDEquipment_Atrribute
    {
        public int id;
        public int Durability;
        public int[] Mosaic;
    }
    public class TPAttribute
    {
        public string name;
        public int value;
    }
    /// <summary>
    /// 当前任务
    /// </summary>
    public class TDRoleAction
    {
        public string name;
        public int stime;
        public int curtime;
        /// <summary>
        /// 执行
        /// </summary>
        /// <param name="gameTime"></param>
        /// <param name="role"></param>
        /// <returns></returns>
        public virtual int StepAction(GameTime gameTime,TDRole role)
        {
            return 0;
        }

        public virtual int EndAction(GameTime gameTime, TDRole role)
        {
            return 0;
        }
        public virtual int StartAction(GameTime gameTime, TDRole role)
        {
            return 0;
        }
    }
    public class TDRoleWalkAction:TDRoleAction
    {
        public Vector3 vstart;
        public Vector3 vend;
        public float angle;
        public List<Vector3> vPath = new List<Vector3>();

        /// <summary>
        /// 执行
        /// </summary>
        /// <param name="gameTime"></param>
        /// <param name="role"></param>
        /// <returns></returns>
        public override int StepAction(GameTime gameTime, TDRole role)
        {
            return 0;
        }
        public override int EndAction(GameTime gameTime, TDRole role)
        {
            return 0;
        }
        public override int StartAction(GameTime gameTime, TDRole role)
        {
            return 0;
        }
    }
    public class TDRole
    {
        public string name;
        public string caption;
        public string description;
        public string icon;
        public string tex;
        SpriteDef sprite;
        /// <summary>
        /// 当前任务
        /// </summary>
        //TDRoleTask roletask;
        /// <summary>
        //属性
        /// </summary>
        public List<TPAttribute> AtrributeList = new List<TPAttribute>();

        /// <summary>
        ///装备
        /// </summary>
        public List<TDEquipment_Atrribute> EquipmentList = new List<TDEquipment_Atrribute>();
        
        /// <summary>
        ///技能
        /// </summary>
        public List<TPSkill_Attribute> SkillList = new List<TPSkill_Attribute>();

        List<BufferSkill> BufferList = new List<BufferSkill>();
        /// <summary>
        /// 得到精灵
        /// </summary>
        /// <returns></returns>
        public SpriteDef GetSpriteDef()
        {
            return sprite;
        }
        public virtual void LoadContent(ContentManager Content)
        {
            sprite = new SpriteDef(Content, tex, 40, true, 64, 64, 13, new Vector2(16, 16));
        }
        /// <summary>
        ///绘制人物
        /// </summary>
        public virtual void draw(GameWindow window, GameTime gameTime, SpriteBatch spriteBatch, int nImgIndex, Vector2 vPos, float fAngle, Color color)
        {
            sprite.Draw(window, gameTime, spriteBatch, nImgIndex, vPos, fAngle, color);
            
        }
    }
    
    public class TDRoles
    {
        public List<TDRole> Roles = new List<TDRole>();
        public void LoadContent(ContentManager Content)
        {
            for (int i = 0; i < Roles.Count; i++)
            {
                Roles[i].LoadContent(Content);
            }
        }
    }

    public class TDEnemy
    {
        /// <summary>
        /// 人物id，对应TDRole
        /// </summary>
        public string roleid;
        /// <summary>
        /// 当前生命值
        /// </summary>
        public int lift;
        /// <summary>
        /// 实际属性。是由各类附加属性综合得到的属性值
        /// </summary>
        public List<TPAttribute> AtrributeList = new List<TPAttribute>();
        /// <summary>
        /// 当前身上的效果
        /// </summary>
        public List<BufferSkill> BufferList = new List<BufferSkill>();
        /// <summary>
        /// 重新计算当前属性值
        /// </summary>
        public void RecalcAttribute()
        {
        }
    }
    public class TDHeroInfo
    {
        public string heroname;
        public string icon;
    }
    public class TDHero:TDRole
    {
        /// <summary>
        /// 英雄信息
        /// </summary>
        public TDHeroInfo  info;
        public override void LoadContent(ContentManager Content)
        {
            base.LoadContent(Content);
        }
        /// <summary>
        ///绘制人物
        /// </summary>
        public override void draw(GameWindow window, GameTime gameTime, SpriteBatch spriteBatch, int nImgIndex, Vector2 vPos, float fAngle, Color color)
        {
            base.draw(window, gameTime, spriteBatch, nImgIndex, vPos, fAngle, color);
        }
    }
}
